<template>
	<view>
		<!-- 头部 -->
		<view class="g-hd">
			<view class="m-user">
				<image class="u-avatar f-mr" src="../../static/images/city2.jpg" mode=""></image>
				<view class="u-user-info f-zfs28">
					<view class="u-user-name f-ptb">sol</view>
					<view class="u-user-id f-ptb">
						<text class="f-mr">
							{{typeString}}
						</text>
						<view class="u-btn-box f-bc" type="default" @click="toSwitchIdentity">
							<text class="u-btn-txt">切换身份</text>
						</view>
					</view>
					<view class="u-user-address f-ptb">{{address}}</view>
				</view>
			</view>
		</view>
		<!-- 设置操作 -->
		<view class="g-bd">
			<view class="m-menu">
				<view class="m-menu-itm" @click="toBuyService">
					<view class="u-menu-l" >
						<image class="u-menu-l-img {" src="../../static/icon/gong.png"></image>
						<view>缴费</view>
					</view>
					<view class="u-menu-r">
						<image class="u-menu-r-img" src="../../static/icon/arrow-right.png"></image>
					</view>
				</view>
				<view class="m-menu-itm" @click="toBuyRecord">
					<view class="u-menu-l">
						<image class="u-menu-l-img {" src="../../static/icon/gong.png"></image>
						<view>缴费记录</view>
					</view>
					<view class="u-menu-r">
						<image class="u-menu-r-img" src="../../static/icon/arrow-right.png"></image>
					</view>
				</view>
			</view>
			
			<view class="m-menu">
				<view class="m-menu-itm">
					<view class="u-menu-l" @click="toMyInfo">
						<image class="u-menu-l-img {" src="../../static/icon/gong.png"></image>
						<view>个人信息</view>
					</view>
					<view class="u-menu-r">
						<image class="u-menu-r-img" src="../../static/icon/arrow-right.png"></image>
					</view>
				</view>
				<view class="m-menu-itm" @click="toAddIdentity">
					<view class="u-menu-l">
						<image class="u-menu-l-img {" src="../../static/icon/gong.png"></image>
						<view>添加身份</view>
					</view>
					<view class="u-menu-r">
						<image class="u-menu-r-img" src="../../static/icon/arrow-right.png"></image>
					</view>
				</view>
				<view class="m-menu-itm" @click="toFamilyMenber">
					<view class="u-menu-l">
						<image class="u-menu-l-img {" src="../../static/icon/gong.png"></image>
						<view>家庭成员</view>
					</view>
					<view class="u-menu-r">
						<image class="u-menu-r-img" src="../../static/icon/arrow-right.png"></image>
					</view>
				</view>
				<view class="m-menu-itm" @click="toMyHouse">
					<view class="u-menu-l">
						<image class="u-menu-l-img {" src="../../static/icon/gong.png"></image>
						<view>我的房屋</view>
					</view>
					<view class="u-menu-r">
						<image class="u-menu-r-img" src="../../static/icon/arrow-right.png"></image>
					</view>
				</view>
				<view class="m-menu-itm" @click="toMyHouse">
					<view class="u-menu-l">
						<image class="u-menu-l-img {" src="../../static/icon/gong.png"></image>
						<view>我的租赁</view>
					</view>
					<view class="u-menu-r">
						<image class="u-menu-r-img" src="../../static/icon/arrow-right.png"></image>
					</view>
				</view>
				<view class="m-menu-itm" @click="toMyRentHouse">
					<view class="u-menu-l">
						<image class="u-menu-l-img {" src="../../static/icon/gong.png"></image>
						<view>访客管理</view>
					</view>
					<view class="u-menu-r">
						<image class="u-menu-r-img" src="../../static/icon/arrow-right.png"></image>
					</view>
				</view>
				<view class="m-menu-itm" @click="toMyHouse">
					<view class="u-menu-l">
						<image class="u-menu-l-img {" src="../../static/icon/gong.png"></image>
						<view>设置</view>
					</view>
					<view class="u-menu-r">
						<image class="u-menu-r-img" src="../../static/icon/arrow-right.png"></image>
					</view>
				</view>
			</view>
			
			<view class="m-menu">
				<view class="m-menu-itm">
					<view class="u-menu-l" @click="toFamilyMenber">
						<image class="u-menu-l-img {" src="../../static/icon/gong.png"></image>
						<view>职位收藏</view>
					</view>
					<view class="u-menu-r">
						<image class="u-menu-r-img" src="../../static/icon/arrow-right.png"></image>
					</view>
				</view>
				<view class="m-menu-itm" @click="toSwitchIdentity">
					<view class="u-menu-l">
						<image class="u-menu-l-img {" src="../../static/icon/gong.png"></image>
						<view>出租屋收藏</view>
					</view>
					<view class="u-menu-r">
						<image class="u-menu-r-img" src="../../static/icon/arrow-right.png"></image>
					</view>
				</view>
			</view>
			
		</view>

	</view>
</template>

<script>
	let app = getApp();

	export default {

		data() {
			return {
				typeString: null,
				address: ''
			}
		},
		mounted() {
			console.log(app.globalData)
			this.typeString = app.globalData.intoIdentity;
			this.address = app.globalData.intoRentAddressName;
		},
		methods: {
			login() {
				uni.login({
					provider: "weixin",
					success() {
						console.log(434)
					},
					fail() {
						console.log(374)
					}
				})
			},

			// 页面跳转
			// 我的信息
			toMyInfo() {
				uni.navigateTo({
					url: 'info/index'
				})
			},
			// 缴费
			toBuyService() {
				uni.navigateTo({
					url: '/pages/my/buyService/serviceList'
				})
			},
			// 缴费记录
			toBuyRecord() {
				uni.navigateTo({
					url: 'buyService/buyRecord'
				})
			},
			// 家庭成员
			toFamilyMenber() {
				uni.navigateTo({
					url: 'info/index?nav_name=' + 'family_menber'
				})
			},
			// 访客管理
			toVisitorManage() {
				uni.navigateTo({
					url: 'visitorManage/index'
				})
			},
			// 我的房屋
			toMyHouse() {
				uni.navigateTo({
					url: 'myHouse/index'
				})
			},
			// 我的出租
			toMyRentHouse() {
				uni.navigateTo({
					url: 'myRentHouse/index'
				})
			},
			// 切换身份
			toSwitchIdentity() {
				uni.reLaunch({
					url: '/pages/idChoose/index'
				})
			},
			// 添加身份
			toAddIdentity() {
				uni.navigateTo({
					url: '/pages/my/addIdentity/index'
				})
			},
			// 设置
			toSetting() {
				uni.navigateTo({
					url: 'setting/index'
				})
			},
			
		}
	}
</script>

<style scoped lang="scss">
	.g-hd {
		display: flex;
		flex-direction: column;
		padding: 30rpx;
		color: #fff;
		background-color: #2A9F93;

		.m-user {
			display: flex;
			align-items: center;

			.u-avatar {
				width: 120rpx;
				height: 120rpx;
				border-radius: 50%;
				border: 4rpx #FFF solid;
			}

			.u-user-id {
				display: flex;
				align-items: center;
			}

			.f-bc {
				border: 1rpx #fff solid;
			}
		}
	}
</style>
